<%@ Page Language="C#" MasterPageFile="~/MasterDefault.master" AutoEventWireup="true"
    CodeBehind="MenuItemsForm.aspx.cs" Inherits="TCMSWeb.MenuItemsForm" Title="Menu Items Form" %>

<%--<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
</asp:Content>--%>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:ScriptManager runat="server" ID="ScriptManager1" EnablePartialRendering="true">
    </asp:ScriptManager>
    <clib:UpdatePanelExtender runat="server" ID="UpdatePanelExtender1" UpdateMode="Conditional">
        <ContentTemplate>
            <br />
            <h3>
                Menu Items &nbsp; &nbsp;&nbsp;
            </h3>
            <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataKeyNames="ID"
                DataSourceID="SqlDataSource1" Height="50px" Width="125px">
                <Fields>
                    <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True"
                        SortExpression="ID" />
                    <asp:BoundField DataField="Target" HeaderText="Target" SortExpression="Target" />
                    <asp:BoundField DataField="MenuItem" HeaderText="MenuItem" SortExpression="MenuItem" />
                    <asp:TemplateField HeaderText="SecurityItemID">
                        <EditItemTemplate>
                            <asp:ListBox ID="ddlSecurityItemID" runat="server" DataValueField="ID" DataTextField="SecurityItem">
                            </asp:ListBox>
                            <%--<asp:DropDownList ID="ddSecurityItemID" runat="server" DataValueField="ID" DataTextField="SecurityItem"
                                DataSource="<%# dsSecurity%>" Width="180px" SelectedIndex='<%# StillVoiceCommon.Functions.DropDownSelIndex(dsSecurityItem ,Convert.ToInt32(DataBinder.Eval(Container, "DataItem.SecurityItemID")), "ID") %>'>
                            </asp:DropDownList>--%>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="SecLabel" runat="server"></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="ParentMenuItemID" HeaderText="ParentMenuItemID" SortExpression="ParentMenuItemID" />
                    <asp:BoundField DataField="Order" HeaderText="Order" SortExpression="Order" />
                    <asp:CheckBoxField DataField="addSeparatorBefore" HeaderText="addSeparatorBefore"
                        SortExpression="addSeparatorBefore" />
                    <asp:BoundField DataField="MenuItemType" HeaderText="MenuItemType" SortExpression="MenuItemType" />
                    <asp:BoundField DataField="ImageFileName" HeaderText="ImageFileName" SortExpression="ImageFileName" />
                    <asp:BoundField DataField="Level" HeaderText="Level" SortExpression="Level" />
                    <asp:CommandField ShowInsertButton="True" />
                </Fields>
            </asp:DetailsView>
            <hr />
            <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
                AutoGenerateColumns="False" DataKeyNames="ID" DataSourceID="SqlDataSource1" SkinID="GridView">
                <Columns>
                    <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
                    <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True"
                        SortExpression="ID" />
                    <asp:BoundField DataField="Target" HeaderText="Target" SortExpression="Target" />
                    <asp:BoundField DataField="MenuItem" HeaderText="Menu Item" SortExpression="MenuItem" />
                    <asp:BoundField DataField="SecurityItemID" HeaderText="SecurityItemID" SortExpression="SecurityItemID" />
                    <asp:BoundField DataField="ParentMenuItemID" HeaderText="ParentMenuItemID" SortExpression="ParentMenuItemID" />
                    <asp:BoundField DataField="Order" HeaderText="Order" SortExpression="Order" />
                    <asp:CheckBoxField DataField="addSeparatorBefore" HeaderText="addSeparatorBefore"
                        SortExpression="addSeparatorBefore" />
                    <asp:BoundField DataField="MenuItemType" HeaderText="Type" SortExpression="MenuItemType" />
                    <asp:BoundField DataField="ImageFileName" HeaderText="Image" SortExpression="ImageFileName" />
                    <asp:BoundField DataField="Level" HeaderText="Level" SortExpression="Level" />
                </Columns>
            </asp:GridView>
            <br />
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TeamTime %>"
                DeleteCommand="DELETE FROM [Security].[MenuItem] WHERE [ID] = @ID" InsertCommand="INSERT INTO [Security].[MenuItem] ([Target], [MenuItem], [SecurityItemID], [ParentMenuItemID], [Order], [addSeparatorBefore], [MenuItemType], [ImageFileName], [Level]) VALUES (@Target, @MenuItem, @SecurityItemID, @ParentMenuItemID, @Order, @addSeparatorBefore, @MenuItemType, @ImageFileName, @Level)"
                SelectCommand="SELECT * FROM [Security].[MenuItem]" UpdateCommand="UPDATE [Security].[MenuItem] SET [Target] = @Target, [MenuItem] = @MenuItem, [SecurityItemID] = @SecurityItemID, [ParentMenuItemID] = @ParentMenuItemID, [Order] = @Order, [addSeparatorBefore] = @addSeparatorBefore, [MenuItemType] = @MenuItemType, [ImageFileName] = @ImageFileName, [Level] = @Level WHERE [ID] = @ID">
                <DeleteParameters>
                    <asp:Parameter Name="ID" Type="Int32" />
                </DeleteParameters>
                <UpdateParameters>
                    <asp:Parameter Name="Target" Type="String" />
                    <asp:Parameter Name="MenuItem" Type="String" />
                    <asp:Parameter Name="SecurityItemID" Type="Int32" />
                    <asp:Parameter Name="ParentMenuItemID" Type="Int32" />
                    <asp:Parameter Name="Order" Type="Int32" />
                    <asp:Parameter Name="addSeparatorBefore" Type="Boolean" />
                    <asp:Parameter Name="MenuItemType" Type="String" />
                    <asp:Parameter Name="ImageFileName" Type="String" />
                    <asp:Parameter Name="Level" Type="Int16" />
                    <asp:Parameter Name="ID" Type="Int32" />
                </UpdateParameters>
                <InsertParameters>
                    <asp:Parameter Name="Target" Type="String" />
                    <asp:Parameter Name="MenuItem" Type="String" />
                    <asp:Parameter Name="SecurityItemID" Type="Int32" />
                    <asp:Parameter Name="ParentMenuItemID" Type="Int32" />
                    <asp:Parameter Name="Order" Type="Int32" />
                    <asp:Parameter Name="addSeparatorBefore" Type="Boolean" />
                    <asp:Parameter Name="MenuItemType" Type="String" />
                    <asp:Parameter Name="ImageFileName" Type="String" />
                    <asp:Parameter Name="Level" Type="Int16" />
                </InsertParameters>
            </asp:SqlDataSource>
        </ContentTemplate>
    </clib:UpdatePanelExtender>
</asp:Content>
